import datetime
def deco_log(when):
    def log(when,msg):
        print when,msg

    def pre_log(f):
        def wrapper(*nkargs,**kargs):
            log('pre',str(datetime.datetime.now()))
            f(*nkargs,**kargs)
        return wrapper
    def post_log(f):
        def wrapper(*nkargs,**kargs):
            f(*nkargs,**kargs)
            print nkargs
            log('post',str(datetime.datetime.now()))
        return wrapper
    dfuncs={'pre':pre_log,'post':post_log}
    wrapper=dfuncs[when]
    return wrapper

@deco_log('post')
def cout(a,b,c):
    print a,b,c

cout(1,2,3)
